package com.faryangsh.rep.one;

import com.faryangsh.bean.one.UserOne;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author 杨志远[of2551]
 *         company qianmi.com
 *         Date    2017-07-11
 */
@Repository
public interface UserOneRepository extends JpaRepository<UserOne, Long> {
    List<UserOne> findByNameAndAddress(String name, String address);

    @Query(value = "from User u where u.name=:name")
    List<UserOne> findByName1(@Param("name") String name);

    @Query(value = "select * from #{#entityName} u where u.name=?1", nativeQuery = true)
    List<UserOne> findByName2(String name);

    List<UserOne> findByName(String name);

    // like % name %  ;upper(user0_.name) like upper(?)
    List<UserOne> findByNameIgnoreCaseContaining(String name);

    //like name
    List<UserOne> findByNameLike(String name);
}
